<?php
/* SVN FILE: $Id$ */
/**
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 * @link          http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.cake.console.libs.templates.skel.views.layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @version       $Revision$
 * @modifiedby    $LastChangedBy$
 * @lastmodified  $Date$
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php echo $html->charset(); ?>
	<title>
		<?php echo $title_for_layout; ?>
	</title>
	<?php
		echo $html->meta('icon');
         
		echo $html->css('default');
        echo $html->css('eventCalendar');
        echo $html->css('jquery.alerts');
		echo $scripts_for_layout;
	?>
	
	<?php echo $javascript->link('vendor/jquery-1.8.0.min.js', array('inline' => false)) ?>
	<?php echo $javascript->link('vendor/modernizr-2.6.1.min.js', array('inline' => false)) ?>
	<?php echo $javascript->link('jquery.lightbox_me.js', array('inline' => false)); ?> 
	<?php echo $javascript->link('dw.js', array('inline' => false)); ?> 
    <?php echo $javascript->link('jquery.eventCalendar.js', array('inline' => false)); ?> 
    <?php echo $javascript->link('jquery.json-2.3.js', array('inline' => false)) ?>
    <?php echo $javascript->link('jquery.form.js', array('inline' => false)) ?>
    <?php echo $javascript->link('jquery.alerts.js', array('inline' => false)); ?>
    
	
</head>
<?php $page = $this->params['controller'].'_'.$this->params['action']?>
<body id ="<?php echo $page ?>">
	<!--CONTAINER-->
	<div class="ctr">
		<!--HEADER-->
		<div id="header">
		<a id="logo" href="<?php echo Router::url('/');?>">Pharmacy Match</a>
			<?php if ( $session->read('User') ):
				$link_edit = $link_view = Router::url('/');
				if( $session->read('User.User.UserType') == 1 )
				{
					$link_view .= 'locums/view/' . $session->read('User.User.id');
					$link_edit .= 'locums/edit/' . $session->read('User.User.id');
				}
				if( $session->read('User.User.UserType') == 2 )
				{
					$link_view .= 'pharmacies/view/' . $session->read('User.User.id');
					$link_edit .= 'pharmacies/index/';
				}
				
				if( $session->read('User.User.UserType') == 3 )
				{
					$link_view .= 'stores/view/' . $session->read('User.User.id');
					$link_edit .= 'stores/edit/' . $session->read('User.User.id');
				}
				
			?>
            <?php endif;?>
			<ul>
				<li>Welcome <span><?php echo $session->read('User.User.Username');?></span></li>
				<?php if($session->read('User.User.isFirstLogin')  ==0){?>
                <li>
                    <a href="<?php echo $link_view;?>">View Account</a>
                </li>
                <?}?>
				<li><a href="<?php echo $link_edit;?>">Edit Account</a></li>
				<li><a href="<?php echo Router::url('/');?>users/logout">Logout</a></li>
			</ul>
			
			<?php 
				if( !isset($a_VacanciesHot) ) $a_VacanciesHot = array();
				if ( count( $a_VacanciesHot ) > 0):
			?>
			<div class="ticker">
				<?php echo $this->element('hotnew'); ?>
			</div>
			<?php endif;?>
		</div>
		<!--HEADER-->
			<?php echo $content_for_layout; ?>
		<!--FOOTER-->
		<footer id="footer"></footer>
		<!--FOOTER-->

		<br class="clear"/>
	</div>
	<!--CONTAINER-->
<script>
    $(document).ready(function()
    {
        $('#UploadImage').click(function(){
            $('#upload-block').removeClass('hide');  
        });
        $('#FileUploader').on('submit', function(e)
        {
            e.preventDefault();
            $(this).ajaxSubmit({
            target: '#output',
            success:  afterSuccess //call function after success
            });
        });
    });
     
    function afterSuccess()
    {
        $('#FileUploader').resetForm();  // reset form
        $('#upload-block').addClass('hide');
        $('#StoreAvatar').val($('#img_avatar').attr('value'));
		jAlert('Image uploaded successfully', 'Message');
    }
</script>	
</body>
</html>